<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <script>
        var num1 = Math.floor(Math.random() * (10 - 1 + 1)) + 1;
        var num2 = prompt('请输入一个数字');
        if (num2 > num1) {
            alert('您输入的数字大了，继续猜吧');
        } else if (num2 < num1) {
            alert('您输入的数字小了，继续猜吧');
        } else {
            alert('您猜对了');
        }
    </script>
</head>

<body>

</body>

</html>